﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public partial class event_show : Form
{
        public event_show()
        {
            InitializeComponent();
            
            
        }
        public static string Days;
        public static string Month;
        public static string Year;
        public static string Event;
        public static string From;
        public static string To;

        public void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
                lblEvent.Text = row.Cells["Event"].Value.ToString();
                lblDay.Text = row.Cells["Day"].Value.ToString();
                lblmonth.Text = row.Cells["Month"].Value.ToString();
                lblYear.Text = row.Cells["Year"].Value.ToString();
                lblFrom.Text = row.Cells["From"].Value.ToString();
                lblTo.Text = row.Cells["To"].Value.ToString();

            }
        }

        public void printToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Event = this.lblEvent.Text.ToString();
            Days = this.lblDay.Text.ToString();
            Month = this.lblmonth.Text.ToString();
            Year = this.lblYear.Text.ToString();
            From = this.lblFrom.Text.ToString();
            To = this.lblTo.Text.ToString();
            if (Event != "")
            {
                Print_PDF pdf = new Print_PDF();
                pdf.print_event();
            }
            else {
                MessageBox.Show("Please press double click on the event !!");
            }
        }

        
    }
}
